// /**
//  * Copyright © 2013-2017 Magento, Inc. All rights reserved.
//  * See COPYING.txt for license details.
//  */

@import 'module/_listings.less';
@import 'module/_toolbar.less';

@product-info-price: @color-gray34;
@product-h1-margin-bottom-desktop: @indent__s + @indent__xs;

//
//    Common
//--------------------------------------

& when (@media-common = true) {

//
//    Category view
//--------------------------------------
.old-price,
.old.price {
    .lib-css(color, @text__color__muted);
}

.price-tier_price {
    .price-including-tax + .price-excluding-tax {
        &:before {
            content: "(" attr(data-label) ":";
        }
        &:last-child:after {
            content: ")";
        }
    }

    .weee[data-label] {
        display: inline;
        &:before {
            content: " +" attr(data-label) ":";
        }
    }
}

.actual-price {
    font-weight: @font-weight__bold;
}

.product.name a {
    &:extend(.abs-product-link all);
}

.special-price {
    .price-label {
        &:extend(.abs-visually-hidden all);
    }
}

.category {
    &-image {
        .image {
            max-width: 100%;
            height: auto;
            display: block;
        }
    }
    &-cms,
    &-image,
    &-description {
        margin-bottom: @indent__base;
    }
}

//
//    Product images general container
//--------------------------------------
.product-image {
    &-container {
        display: inline-block;
        max-width: 100%;
    }
    &-wrapper {
        height: 0;
        display: block;
        position: relative;
        z-index: 1;
        overflow: hidden;
    }
    &-photo {
        display: block;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        margin: auto;
        height: auto;
        max-width: 100%;
    }
}

//
//    Product view
//--------------------------------------
.product.media {
    .product.photo .photo.image {
        &:extend(.abs-adaptive-images-centered);
    }
    .placeholder .photo.container {
        max-width: 100%;
    }
    .notice {
        margin: @indent__s 0;
        .lib-css(color, @text__color__muted);
        .lib-font-size(@font-size__s);
    }
    .product.thumbs {
        margin: @indent__s 0 @indent__m;
    }
    .items.thumbs {
        .lib-list-inline();
        > li {
            margin: 1rem 0 0;
        }
        img {
            display: block;
        }
        .active {
            display: block;
            line-height: 1;
        }
    }
}

.product.info.detailed {
    clear: both;
    margin-bottom: 30px;
    .additional-attributes {
        width: auto;
        .lib-table-bordered(
            @_table_type: clear
        );
        .lib-table-resize(
            @_th-padding-left: 0,
            @_th-padding-right: @indent__l,
            @_th-padding-bottom: @indent__s,
            @_td-padding-bottom: @indent__s
        );
    }
}

.product-info-main {
    .product-info-price {
        border-bottom: 1px @color-gray-light5 solid;
        display: table;
        width: 100%;
        .lib-css(color, @product-info-price);
        margin-bottom: @indent__s + @indent__xs;
        .price-box {
            display: table-cell;
            vertical-align: top;
            .price-final_price > span {
                display: block;
                margin-bottom: @indent__xs;
                &:last-child {
                    margin-bottom: 0;
                }
            }
        }
        .price-including-tax + .price-excluding-tax,
        .weee + .price-excluding-tax,
        .weee {
            .lib-font-size(14);
            .price {
                .lib-font-size(14);
                font-weight: @font-weight__semibold;
                line-height: 16px;
            }
        }
        .price-wrapper .price {
            .lib-font-size(22);
            font-weight: @font-weight__semibold;
            line-height: 22px;
        }
        .old-price {
            .price-wrapper .price {
                .lib-font-size(20);
                font-weight: @font-weight__light;
            }
        }
        .special-price {
            .price-label {
                &:after {
                    content: ": ";
                }
            }
        }
    }
    .product-info-stock-sku {
        min-width: 15rem;
        text-align: right;
        display: table-cell;
        vertical-align: top;
        padding-left: 10%;
        padding-bottom: @indent__s;
    }
    .stock {
        margin: 0 0 3px;
        &.available,
        &.unavailable {
            font-weight: @font-weight__bold;
            text-transform: uppercase;
        }
    }
    .product.attibute.sku {
        word-wrap: break-word;
    }
    .product {
        &-add-form {
            clear: both;
            padding-top: @indent__s + @indent__xs;
        }

        &.attibute {
            &.sku {
                .type {
                    font-weight: normal;
                    margin-right: @indent__xs;
                    &:after {
                        content: '#:';
                    }
                }
                .value {
                    display: inline-block;
                }
            }
            &.overview {
                margin: @indent__base 0;
            }
        }
        &.alert {
            margin: @indent__s 0;
        }
    }
    .product-reviews-summary {
        float: left;
    }
    .product-options-bottom {
        .box-tocart {
            margin-top: @form-field__vertical-indent;
        }
    }
}

.product-options-wrapper {
    .fieldset-product-options-inner {
        .legend {
            border: none;
            .lib-css(font-weight, @font-weight__semibold);
            display: inline-block;
            .lib-font-size(14px);
            float: none;
            padding: 0;
            margin: 0 0 8px;
        }
        &.required {
            .legend {
                &:after {
                    content: '*';
                    .lib-typography(
                    @_font-size: @form-field-label-asterisk__font-size,
                    @_color: @form-field-label-asterisk__color,
                    @_font-family: @form-field-label-asterisk__font-family,
                    @_font-weight: @form-field-label-asterisk__font-weight,
                    @_line-height: @form-field-label-asterisk__line-height,
                    @_font-style: @form-field-label-asterisk__font-style
                    );
                    .lib-css(margin, @form-field-label-asterisk__margin);
                }
            }
        }
    }
    .field {
        .note {
            display: block;
            .lib-css(margin-top, @indent__xs);
        }
    }
}

.product-options-bottom .price-box,
.product-info-price .price-box {
    .lib-css(color, @product-info-price);
    display: table-cell;
    vertical-align: top;
    padding-bottom: @indent__s;
    .old-price {
        font-size: 20px;
        font-weight: @font-weight__light;
        .price-container > span {
            display: inline-block;
        }
    }
    .price-container {
        > span {
            display: block;
            margin-bottom: @indent__xs;
            &:last-child {
                margin-bottom: 0;
            }
        }
        .price {
            font-size: 22px;
            line-height: 22px;
            font-weight: @font-weight__semibold;
        }
        .price-including-tax + .price-excluding-tax,
        .weee + .price-excluding-tax,
        .weee {
            .lib-font-size(12);
            line-height: 14px;
            .price {
                .lib-font-size(12);
                font-weight: @font-weight__bold;
            }
        }
    }
}

.box-tocart {
    &:extend(.abs-box-tocart all);
    .field.qty {
    }
    .input-text.qty {
        &:extend(.abs-input-qty all);
    }
    .actions {
    }
    .action.tocart {
        &:extend(.abs-button-l all);
        &:extend(.abs-button-responsive all);
        &:not(:last-child) {
            margin-bottom: 15px;
        }
        vertical-align: top;
    }
}

.product-addto-links {
    display: inline;
    .action {
        margin-right: 5%;
    }
}

.product-social-links {
    margin: 0 0 20px;
    text-align: center;
    .action.tocompare {
        &:extend(.abs-actions-addto all);
        .lib-icon-font-symbol(
            @_icon-font-content: @icon-compare-full,
            @_icon-font-position: before
        );
    }
}

.prices-tier {
    &:extend(.abs-reset-list all);
    margin-bottom: @indent__s + @indent__xs;
    .item {
        margin-bottom: @indent__s;
        &:last-child {
            margin-bottom: 0;
        }
    }
    .price-excluding-tax,
    .price-including-tax {
        display: inline-block;
    }
}

.minimal-price-link,
.price-excluding-tax,
.price-including-tax {
    white-space: nowrap;
    display: block;
}

.ui-dialog-titlebar-close {
    .lib-button-as-link();
}


//
//    Sidebar product view
//--------------------------------------
.sidebar {
    .product-items {
        .product-item {
            margin-bottom: @indent__base;
            position: relative;
            &-info {
                position: relative;
                width: auto;
                .product-item-photo {
                    position: absolute;
                    left: 0;
                    top: 0;
                }
            }
            &-name {
                margin-top: 0;
            }
            &-details {
                margin: 0 0 0 85px;
            }
            &-actions {
                display: block;
                margin-top: @indent__s;
            }
        }
        .price-box {
            display: block;
            margin: 7px 0;
        }
        .text {
            margin-right: 8px;
        }
        .counter {
            .lib-css(color, @primary__color__lighter);
            font-size: 12px;
            white-space: nowrap;
        }
        .minilist {
            .price {
                display: inline;
                padding: 0;
            }
            .weee:before {
                display: inline-block;
            }
        }
        .action {
            &.delete {
                &:extend(.abs-remove-button-for-blocks all);
                position: absolute;
                right: 0;
                top: 0;
            }
        }
    }

    .action.tocart {
        border-radius: 0;
    }

    .subtitle {
        &:extend(.abs-no-display all);
    }

    //
    //    Product images only
    //--------------------------------------
    .product-items-images {
        &:extend(.abs-add-clearfix all);
        margin-left: -@indent__xs;
        .product-item {
            &:extend(.abs-add-box-sizing all);
            float: left;
            padding-left: @indent__xs;
        }
    }

    //
    //    Product names only
    //--------------------------------------
    .product-items-names {
        .product-item {
            margin-bottom: @indent__s;
        }
        .product-item-name {
            margin: 0;
        }
    }
}

}

//
//    Mobile @screen__m
//--------------------------------------
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
    .catalog-product-view {
        .column.main {
            .lib-vendor-prefix-display(flex);
            .lib-vendor-prefix-flex-direction(column);
        }
        .product.media {
            .lib-vendor-prefix-order(-1);
        }
    }
}

//
//    Mobile @screen__s
//--------------------------------------
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
    .product-social-links {
        .action.tocompare {
            display: none;
        }
    }
    .product-info-price {
        margin: 0 -@indent__s 0;
        width: ~"calc(100% + 2*@{indent__s})"!important;
        > *:first-child {
            padding-left: @indent__s;
        }
        > *:last-child {
            padding-right: @indent__s;
        }
    }
    .product.info.detailed {
        .additional-attributes-wrapper {
            &:extend(.abs-no-border-top all);
        }
    }
}

//
//    Desktop
//--------------------------------------
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .product-info-main {
        .page-title-wrapper {
            h1 {
                .lib-css(margin-bottom, @product-h1-margin-bottom-desktop);
            }
        }
        .product-add-form {
            padding-top: @indent__base;
        }
    }

    .box-tocart {
        .action.tocart {
            width: 49%;
            margin-right: 1%;
            margin-bottom: 0;
        }
    }

    .product-social-links {
        text-align: left;
    }

    .product-options-bottom,
    .product-info-price {
        .price-box {
            .price-container {
                font-size: @font-size__xl;
                .price {
                    font-size: 36px;
                    line-height: 36px;
                }
            }
            .price-including-tax + .price-excluding-tax {
                .price {
                    .lib-font-size(14);
                    line-height: 16px;
                }
            }
        }
    }

    //
    //    Category page layout
    //--------------------------------------
    .product-info-main {
        float: right;
    }

    .product.media {
        float: left;
        margin-bottom: @indent__m;
    }

    .page-layout-1column {
        .product-info-main {
            width: 40%;
        }
        .product.media {
            width: 57%;
        }
    }

    .page-layout-2columns-left,
    .page-layout-2columns-right,
    .page-layout-3columns {
        .product-info-main {
            width: 48%;
        }
        .product.media {
            width: 50%;
        }
    }

    .product-add-form {
        .product-options-wrapper .field:not(.date) {
            > .control {
                width: 80%;
            }
        }
    }

    .sidebar {
        .product-items {
            .product-item {
                &-info {
                    .product-item-photo {
                        position: relative;
                        left: auto;
                        top: auto;
                        float: left;
                        margin: 0 @indent__s @indent__s 0;
                    }
                }
                &-details {
                    margin: 0;
                }
                &-actions {
                    clear: left;
                }
            }
        }
    }
}

//
//    Desktop large
//--------------------------------------
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__xl) {
    .sidebar {
        .product-items {
            .product-item {
                &-info {
                    .product-item-photo {
                        float: none;
                        margin: 0;
                        position: absolute;
                        left: 0;
                        top: 0;
                    }
                }
                &-details {
                    margin-left: 85px;
                }
            }
        }
    }
}


//
//    Common
//--------------------------------------

& when (@media-common = true) {

//
//    Compare Products Page
//--------------------------------------
body.catalog-product-compare-index {
    .action.print {
        float: right;
        margin: 15px 0;
    }
}

.table-wrapper.comparison {
    clear: both;
    max-width: 100%;
    overflow-x: auto;
    .table-comparison > tbody > tr{
        > th,
        > td {
            border-top: 0;
        }
    }
}

.table-comparison {
    table-layout: fixed;

    .cell.label.remove,
    .cell.label.product {
        span {
            &:extend(.abs-visually-hidden all);
        }
    }

    .cell.label,
    td:last-child {
        border-right: @table__border-width @table__border-style @table__border-color;
    }

    .cell {
        width: 180px;
        padding: 15px;
        .attibute.value {
            width: 100%;
            overflow: hidden;
        }

        &.product.info,
        &.product.label {
            border-bottom: @table__border-width @table__border-style @table__border-color;
        }
        &.label {
            .attribute.label {
                display: block;
                width: 100%;
                word-wrap: break-word;
            }
        }
        &.attribute {
            .lib-font-size(13);
            img {
                max-width: 100%;
                height: auto;
            }
        }
        &.remove {
            padding-top: 0;
            padding-bottom: 0;
            text-align: right;
            .action.delete {
                &:extend(.abs-remove-button-for-blocks all);
            }
        }
    }

    .product-item-photo {
        display: block;
        margin: 0 auto 15px;
    }
    .product-image-photo {
        margin-left: 0;
    }

    .product-item-actions,
    .price-box,
    .product.rating,
    .product-item-name {
        display: block;
        margin: 15px 0;
    }

    .product-addto-links {
        margin-top: 15px;

        .action.split,
        .action.toggle {
            .lib-button-s();
        }

        .action.toggle {
            padding: 0;
        }
    }

    .action {
        &.tocart {
            white-space: nowrap;
        }
    }
}

.comparison.headings {
    position: absolute;
    z-index: 2;
    top: 0;
    left: 0;
    width: auto;
    .lib-css(background, @color-white);
}

.block-compare {
    .block-title {
        &:extend(.abs-block-widget-title all);
    }
    .product-item .product-item-name {
        margin-left: 22px;
    }
    .action.delete {
        &:extend(.abs-remove-button-for-blocks all);
        position: absolute;
        left: 0;
        top: 0;
    }
    .counter {
        &:extend(.abs-block-items-counter all);
    }
    .actions-toolbar {
        margin: 17px 0 0;
    }

    .action.primary {
        &:extend(.abs-revert-to-action-secondary all);
    }
}

}

//
//    Mobile
//--------------------------------------
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__s) {
    .table-wrapper.comparison {
        .table-comparison > tbody > tr{
            > th,
            > td {
                display: table-cell;
                &:extend(.abs-col-no-prefix all);
            }
        }
    }
}
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
    .compare.wrapper,
    [class*="block-compare"] {
        display: none;
    }
}

//
//    Desktop
//--------------------------------------
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) {
    .compare.wrapper {
        float: right;
        .lib-list-reset-styles();
        .action.compare {
            line-height: @form-element-input__height;
            .lib-link(
                @_link-color: @primary__color,
                @_link-text-decoration: none,
                @_link-color-visited: @primary__color,
                @_link-text-decoration-visited: none,
                @_link-color-hover: @primary__color,
                @_link-text-decoration-hover: underline,
                @_link-color-active: @primary__color,
                @_link-text-decoration-active: underline
            );
        }
        .counter.qty {
            .lib-css(color, @primary__color__lighter);
            &:before {
                content: "(";
            }
            &:after {
                content: ")";
            }
        }
    }
}

//
//    Common
//--------------------------------------

& when (@media-common = true) {

.block.related {
    .action.select {
        &:extend(.abs-action-button-as-link all);
        vertical-align: top;
    }
    .product-item-details {
        position: relative;
        z-index: 1;
    }
    .related-available .product-item-name {
        margin-left: 20px;
    }
    .field.choice {
        position: absolute;
        top: 2px;
        left: 0;
        .label {
            &:extend(.abs-visually-hidden all);
        }
    }
}

}

//
//    Desktop large
//--------------------------------------
.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) {
    .box-tocart {
        .paypal:first-of-type {
            margin-top: 13px;
        }
    }
}
